const request = require("../../utils/request1.js")
Component({
  data: {
    // tabPanelstyle: 'display:flex;justify-content:center;align-items:center;',
    all:[
      {id:1,image:"/image/咖啡机1.jpg",text:'咖啡机咖啡机1',price:"待付款",
      all1:[]
    }
    ],
    list1:[
      {id:1,text:'咖啡机咖啡机1',price:"待付款",color1:'#dac89d',
      color:'#0e0e0e',size:'1.1rem;',weight:'bold;'},
      {id:2,text:'价格',price:"￥200/月",color:'#cfcfcf'},
      {id:3,text:'押金',price:"￥200",color:'#cfcfcf'},
      {id:4,text:'规格',price:"22期",color:'#cfcfcf'},
      {id:5,text:'数量',price:"1",color:'#cfcfcf'},
    ],
    list2:[
      {id:1,text:'咖啡机咖啡机1',price:"待收货",color1:'#dac89d',
      color:'#0e0e0e',size:'1.1rem;',weight:'bold;'},
      {id:2,text:'价格',price:"￥200/月",color:'#cfcfcf'},
      {id:3,text:'押金',price:"￥200",color:'#cfcfcf'},
      {id:4,text:'规格',price:"22期",color:'#cfcfcf'},
      {id:5,text:'数量',price:"1",color:'#cfcfcf'},
    ],
    list3:[
      {id:1,text:'咖啡机咖啡机1',price:"租赁中",color1:'#dac89d',
      color:'#0e0e0e',size:'1.1rem;',weight:'bold;'},
      {id:2,text:'价格',price:"￥200/月",color:'#cfcfcf'},
      {id:3,text:'押金',price:"￥200",color:'#cfcfcf'},
      {id:4,text:'规格',price:"22期",color:'#cfcfcf'},
      {id:5,text:'数量',price:"1",color:'#cfcfcf'},
    ],
    list4:[
      {id:1,text:'咖啡机咖啡机1',price:"已到期",color1:'#dac89d',
      color:'#0e0e0e',size:'1.1rem;',weight:'bold;'},
      {id:2,text:'价格',price:"￥200/月",color:'#cfcfcf'},
      {id:3,text:'押金',price:"￥200",color:'#cfcfcf'},
      {id:4,text:'规格',price:"22期",color:'#cfcfcf'},
      {id:5,text:'数量',price:"1",color:'#cfcfcf'},
    ],
    list5:[
      {id:1,text:'咖啡机咖啡机1',price:"已归还",color1:'#dac89d',
      color:'#0e0e0e',size:'1.1rem;',weight:'bold;'},
      {id:2,text:'价格',price:"￥200/月",color:'#cfcfcf'},
      {id:3,text:'押金',price:"￥200",color:'#cfcfcf'},
      {id:4,text:'规格',price:"22期",color:'#cfcfcf'},
      {id:5,text:'数量',price:"1",color:'#cfcfcf'},
    ],
    // 查询订单
    order:''
  },
  methods: {
    onLoad(options) {
      // 查询订单接口
    this.getQueryOrdere ()
    // 租赁期限规格
      this.getLease()
    },
    // 查询租赁订单接口
    getQueryOrdere (){
      const _this = this
      request.wxRequest('order/list', function (err, data) {
      console.log(data.data.list);
      if (err) {
             // 失败；
      } else {
          _this.setData({
            order:data.data.list
          })
      }
      }, 'GET', {
      })
  },
    // 租赁期限规格
    getLease (){
      const _this = this
      request.wxRequest('order/spec?id=1', function (err, data) {
      // console.log(data);
      if (err) {
             // 失败；
      } else {
          _this.setData({
            MineList: data.data.user
          })
      }
      }, 'GET', {
         id:1,
      })
  },
    // 跳转待付款
    goDetails1(){
      wx.navigateTo({
        url: '/pages/OrderDetails/OrderDetails',
      })
    },
    // 跳转待收货
    goDetails2(){
      wx.navigateTo({
        url: '/pages/OrderDetails1/OrderDetails1',
      })
    },
     // 跳转租赁中
     goDetails3(){
      wx.navigateTo({
        url: '/pages/OrderDetails2/OrderDetails2',
      })
    },
    // 跳转已到期
    goDetails4(){
        wx.navigateTo({
          url: '/pages/OrderDetails3/OrderDetails3',
          })
      },
    // 跳转已归还
    goDetails5(){
      wx.navigateTo({
        url: '/pages/OrderDetails4/OrderDetails4',
        })
    },
    onTabsChange(event) {
      console.log(`Change tab, tab-panel value is ${event.detail.value}.`);
    },

    onTabsClick(event) {
      console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
    },
  },
});
